import asyncio

# 异步任务
async def async_task(task_id):
    print(f"Async task {task_id} started")
    await asyncio.sleep(2)  # 模拟耗时操作
    print(f"Async task {task_id} completed")

# 异步执行
async def run_async():
    start_time = asyncio.get_event_loop().time()
    await asyncio.gather(*(async_task(i) for i in range(3)))
    print(f"Async tasks completed in {asyncio.get_event_loop().time() - start_time:.2f} seconds")

# 运行异步任务
asyncio.run(run_async())